<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <div class="box1"></div>
  <div class="box2"></div>
  <ul class="ul1">
    <li class="li1">小丽1号</li>
    <li class="li2">小丽2号</li>
    <li class="li3">小丽3号</li>
  </ul>
  <script>
    //关键:根据css选择器获取元素!!
    console.log(document.querySelector('.box1')); //box1
    console.log(document.querySelector('.box2')); //box2
    console.log(document.querySelector('ul li:first-child'));  //ul 中的第一个li
    console.log(document.querySelector('.ul1 .li1').innerHTML);
    console.log(document.querySelector('.ul1 .li2').innerHTML);
    console.log(document.querySelector('.ul1 .li3').innerHTML);
    const lis = document.querySelectorAll('.ul1 li'); //伪数组 无法通过 pop() push() 方法增删元素
    //对数组进行遍历
    for (let i = 0; i < lis.length; i++) {
      console.log(lis[i].innerHTML);
    }
  </script>
</body>
</html>